package com.chenyaowei.product.vo;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;
import java.util.Set;

public class ProductSearchConditionVO implements Serializable {

    private static final long serialVersionUID = 1L;

    private List<ProductCategory> categories;

    public static class ProductCategory {
        private Long catId;
        private String name;
        private Long parentCid;
        private Long catLevel;
        private Set<ProductBrand> brands;
        private List<ProductAttr> attrs;
        private List<ProductCategory> children;

        public Long getCatId() {
            return catId;
        }

        public void setCatId(Long catId) {
            this.catId = catId;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Long getParentCid() {
            return parentCid;
        }

        public void setParentCid(Long parentCid) {
            this.parentCid = parentCid;
        }

        public Long getCatLevel() {
            return catLevel;
        }

        public void setCatLevel(Long catLevel) {
            this.catLevel = catLevel;
        }

        public Set<ProductBrand> getBrands() {
            return brands;
        }

        public void setBrands(Set<ProductBrand> brands) {
            this.brands = brands;
        }

        public List<ProductAttr> getAttrs() {
            return attrs;
        }

        public void setAttrs(List<ProductAttr> attrs) {
            this.attrs = attrs;
        }

        public List<ProductCategory> getChildren() {
            return children;
        }

        public void setChildren(List<ProductCategory> children) {
            this.children = children;
        }
    }

    public static class ProductAttr {
        /**
         * 属性id
         */
        private Long attrId;

        /**
         * 属性名
         */
        private String attrName;

        /**
         * 可选值列表[用逗号分隔]
         */
        private String valueSelect;

        public Long getAttrId() {
            return attrId;
        }

        public void setAttrId(Long attrId) {
            this.attrId = attrId;
        }

        public String getAttrName() {
            return attrName;
        }

        public void setAttrName(String attrName) {
            this.attrName = attrName;
        }

        public String getValueSelect() {
            return valueSelect;
        }

        public void setValueSelect(String valueSelect) {
            this.valueSelect = valueSelect;
        }
    }

    public static class ProductBrand {
        /**
         * 品牌id
         */
        private Long brandId;

        /**
         * 品牌名
         */
        private String brandName;

        public Long getBrandId() {
            return brandId;
        }

        public void setBrandId(Long brandId) {
            this.brandId = brandId;
        }

        public String getBrandName() {
            return brandName;
        }

        public void setBrandName(String brandName) {
            this.brandName = brandName;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null || getClass() != obj.getClass()) {
                return false;
            }
            ProductBrand other = (ProductBrand) obj;
            return brandId.equals(other.brandId);
        }

        @Override
        public int hashCode() {
            return Objects.hash(brandId);
        }

    }

    public List<ProductCategory> getCategories() {
        return categories;
    }

    public void setCategories(List<ProductCategory> categories) {
        this.categories = categories;
    }
}
